﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ProTypeRefAll.aspx.cs" Inherits="CNVP.JShop.Web.Admin.ProTypeRefAll" %>
<%@ Import NameSpace="System.Data"%>
<%@ Import Namespace="CNVP.JShop.BLL" %>
<%@ Import Namespace="CNVP.JShop.Model" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta content="IE=7" http-equiv="X-UA-Compatible" />
    <link href="CSS/Edit.css" rel="stylesheet" type="text/css" />
    <link href="../CSS/jquery.ui.all.css" rel="stylesheet" type="text/css" />
    <script src="../Scripts/jquery.js" type="text/javascript"></script>
    <script src="./Common/jquery.ui.core.js" type="text/javascript"></script>
    <script src="./Common/jquery.ui.widget.js" type="text/javascript"></script>
    <script src="./Common/jquery.ui.tabs.js" type="text/javascript"></script>
    <script src="../Scripts/Common.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $("#tabs").tabs();
        });
        $(function () {
            $("#btUp").click(function () {
                var $txtProTypeName = $("#txtProTypeName");
                if ($txtProTypeName.val() == "") {
                    alert("请输入类型名称！");
                    $txtProTypeName.focus();
                    return false;
                }
                return true;
            });
        });
	</script>
</head>
<body>
    <form id="form1" runat="server">
        <div class="Content">
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="cell">
                <tr>
                    <td class="cell_group">
                        <img src="Images/ListIconTitle.jpg" alt="" />&nbsp;您的位置：<a href="ProductTypeList.aspx">类型管理</a><asp:Label ID="lbTitle" runat="server"></asp:Label>
                    </td>
                </tr>
                </table>
       <div id="tabs">
	    <ul>
		    <li><a href="#tabs-1">基本设置</a></li>
		    <li><a href="#tabs-2">规格</a></li>
            <% if (IsRefExtendProperty == 1)
               { %>
               <li><a href="#tabs-3">扩展属性</a></li>
            <%}%>
            <% if (IsRefDescripttion == 1)
               { %>
               <li><a href="#tabs-4">详细参数表</a></li>
            <%}%>
            <% if (IsRefShopMustInfo == 1)
               { %>
               <li><a href="#tabs-5">购物必填信息</a></li>
            <%}%>
	    </ul>
	    <div id="tabs-1">
            <!--Begin 基本设备-->
                <table border="0" cellpadding="0" cellspacing="0"  class="division">
                <tr>
                    <th>
                        类型名称:</th>
                    <td>
                        <asp:TextBox ID="txtProTypeName" runat="server" MaxLength="50" />
                    </td>
                </tr>
                <tr id="IsBranks" runat="server" visible="false">
                    <th>
                        关联品牌:</th>
                    <td>
                        <asp:CheckBoxList ID="cbRefBranks" runat="server" RepeatDirection="Horizontal" 
                            RepeatColumns="10" CssClass="RadioButtonListTable">
                        </asp:CheckBoxList>
                        <asp:Label ID="lbRefBranks" runat="server"></asp:Label>
                    </td>
                </tr>
                </table>
             <!--End 基本设备-->
        </div>
	    <div id="tabs-2">
            <!--Begin 规格-->
                <script type="text/javascript">
                    $(function () {
                        //隐藏模板tr
                        $("#tbRefStandard tr").eq(2).hide();
                        var i = 0;
                        $("#BtAddTabs2").click(function () {
                            //复制一行
                            var tr = $("#tbRefStandard tr").eq(2).clone();
                            tr.find("td").get(0).innerHTML = ++i;
                            tr.show();
                            tr.appendTo("#tbRefStandard");
                        });
                        $("#BtDelTabs2").click(function () {
                            if (ifCheckCommon("tbRefStandard")) {
                                if (confirm("你确定要删除！")) {
                                    $("#tbRefStandard tr:gt(2)").each(function () {
                                        if ($(this).find("#CKTab2").get(0).checked == true) {
                                            $(this).remove();
                                        }
                                    });
                                    i = 0;
                                    $("#tbRefStandard tr:gt(2)").each(function () {
                                        $(this).find("td").get(0).innerHTML = ++i;
                                    });
                                    $("#CKATabs2").attr("checked", false);
                                }
                            }
                            else {
                                alert('请选择记录！');
                                return false;
                            }
                        });
                        $("#CKATabs2").click(function () {
                            $("#tbRefStandard tr:gt(2)").each(function () {
                                $(this).find("#CKTab2").get(0).checked = $("#CKATabs2").get(0).checked;
                            });
                        });
                    })
                </script>
               
                <table id="tbRefStandard" width="100%" class="division">
                       <tr>
                            <td colspan="4">
                                 <input id="BtAddTabs2" type="button" value="添加规格" />
                           &nbsp;<input id="BtDelTabs2" type="button" value="删除规格" />
                                </td>
                        </tr>
                        <tr>
                            <td class="CheckBoxEdit"></td>
                            <td class="CheckBoxEdit">
                                <input id="CKATabs2" name="CKATabs2" type="checkbox" /></td>
                            <td >
                                规格</td>
                            <td >
                                商品列表页显示方式</td>
                        </tr>
                        <tr>
                            <td class="CheckBoxEdit"></td>
                                <td class="CheckBoxEdit">
                                    <input id="CKTab2" name="CKTab2" type="checkbox"/>
                                    <input id="CKTab2Standard" name="CKTab2Standard" type="checkbox" checked="checked" class="Display" />
                                    </td>
                                <td>
                                    <%=optionNull %>
                                    </td>
                                <td >
                                    <select id="ddlShowWay" name="ddlShowWay" >
                                        <option value="0">可筛选-平铺显示</option>
                                        <option value="1">可筛选-下拉筛选</option>
                                        <option value="2">不作为筛选项</option>
                                    </select>
                                    </td>
                            </tr>
                            <asp:Repeater ID="rptListTabs2" runat="server" 
                           onitemdatabound="rptListTabs2_ItemDataBound" >
                            <ItemTemplate>
                               <tr>
                                    <td class="CheckBoxEdit"></td>
                                    <td class="CheckBoxEdit">
                                        <input id="CKTab2" name="CKTab2" type="checkbox" value='<%# Eval("ID")%>'/>
                                         <input id="CKTab2Standard" name="CKTab2Standard" type="checkbox" checked="checked" value='<%# Eval("ID")%>' class ="Display"/>
                                        </td>
                                    <td>
                                        <asp:Label ID="lbStandard" runat="server" ></asp:Label>
                                        <asp:Label ID="lbStandardID" runat="server" Text='<%# Eval("StandardID")%>' CssClass="Display"></asp:Label>
                                        </td>
                                    <td >
                                        <select id="ddlShowWay" name="ddlShowWay">
                                            <option value="0" <%# Eval("ShowWay").ToString()=="0"? "selected='selected'":"" %>>可筛选-平铺显示</option>
                                            <option value="1" <%# Eval("ShowWay").ToString()=="1"? "selected='selected'":"" %>>可筛选-下拉筛选</option>
                                            <option value="2" <%# Eval("ShowWay").ToString()=="2"? "selected='selected'":"" %>>不作为筛选项</option>
                                        </select>
                                        </td>
                                </tr>
                            </ItemTemplate>
                        </asp:Repeater>
                    </table>
            <!--End 规格-->
        </div>
	   <% if (IsRefExtendProperty == 1)
        { %>
        <div id="tabs-3">
            <!-- Begin扩展属性 -->
                    <script type="text/javascript">
                        $(document).ready(function () {
                            var i = 0;
                            $("#BtAdd").click(function () {
                                //复制一行
                                var $table = $("#tbRefExtendProperty tr");
                                var len = $table.length-1;
                                //alert(len);
                                var AddTr = "";
                                AddTr += "<tr>";
                                AddTr += "<td class=\"CheckBoxEdit\">" + len + "</td>";
                                AddTr += "<td class=\"CheckBoxEdit\"><input id=\"CK\" name=\"CK\" type=\"checkbox\"/><input id=\"CKProperty\" name=\"CKProperty\" type=\"checkbox\" checked=\"checked\" class =\"Display\"/></td>";
                                AddTr += "<td>";
                                AddTr += "	<input id=\"ExtendPropertyName" + len + "\" type=\"text\" name=\"ExtendPropertyName\" maxlength=\"50\" style=\"width:100px;\" /></td>";
                                AddTr += "<td >";
                                AddTr += "	<select id=\"StageShowType" + len + "\" name=\"StageShowType\" onchange='StageShowTypeOnchange(" + len + ")' style=\"width:120px;\" >";
                                AddTr += "		<optgroup label=\"选择项\">";
                                AddTr += "			<option value=\"0\">选择项-渐进式筛选</option>";
                                AddTr += "			<option value=\"1\">选择项-下拉筛选</option>";
                                AddTr += "			<option value=\"2\">选择项-不可筛选</option>";
                                AddTr += "		</optgroup>";
                                AddTr += "		<optgroup label=\"输入项\">";
                                AddTr += "			<option value=\"3\">输入项-可搜索</option>";
                                AddTr += "			<option value=\"4\">输入项-不可搜索</option>";
                                AddTr += "		</optgroup>";
                                AddTr += "	</select>";
                                AddTr += "	</td>";
                                AddTr += "<td>";
                                AddTr += "	 <input id=\"ItemValue" + len + "\" type=\"text\" name=\"ItemValue\" onchange='ItemValueOnchange(" + len + ")'  style=\"width:250px;\" maxlength=\"100\" />";
                                AddTr += "	 <input id=\"SelectItemValue" + len + "\" type=\"text\" name=\"SelectItemValue\" class =\"Display\" />";
                                AddTr += "	</td>";
                                AddTr += "<td>";
                                AddTr += "	<select id=\"IsShow" + len + "\" name=\"IsShow\">";
                                AddTr += "			<option value=\"1\">是</option>";
                                AddTr += "			<option value=\"0\">否</option>";
                                AddTr += "	</select>";
                                AddTr += "	</td>";
                                AddTr += "<td>";
                                AddTr += "	<input id=\"OrderID\" type=\"text\" name=\"OrderID\" value=\"" + len + "\" style=\"width:50px;\" /></td>";
                                AddTr += "</tr>";
                                $("#tbRefExtendProperty").append(AddTr);
                            });
                            $("#BtDel").click(function () {
                                 if (ifCheckCommon("tbRefExtendProperty")) {
                                    if (confirm("你确定要删除！")) {
                                        $("#tbRefExtendProperty tr:gt(1)").each(function () {
                                            if ($(this).find("#CK").get(0).checked == true) {
                                                $(this).remove();
                                            }
                                        });
                                        i = 0;
                                        $("#tbRefExtendProperty tr:gt(1)").each(function () {
                                            $(this).find("td").get(0).innerHTML = ++i;
                                        });
                                        $("#CKA").attr("checked", false);
                                    }
                                }
                                else {
                                    alert('请选择记录！');
                                    return false;
                                }
                            });
                            $("#CKA").click(function () {
                                $("#tbRefExtendProperty tr:gt(1)").each(function () {
                                    $(this).find("#CK").get(0).checked = $("#CKA").get(0).checked;
                                });
                            });
                        })
                        function StageShowTypeOnchange(index) {
                            var StageShowTypeValue = $("select[id=StageShowType" + index + "]").val();
                            var SelectItemValue = document.getElementById("SelectItemValue" + index + "");
                            var ItemValue = $("input[id=ItemValue" + index + "]");
                            if (StageShowTypeValue == "3" || StageShowTypeValue == "4") {
                                ItemValue.css("display", "none");
                                SelectItemValue.value = "";
                            }
                            else {
                                ItemValue.css("display", "");
                            }
                        }
                        function ItemValueOnchange(index) {
                            var ItemValue = $("input[id=ItemValue" + index + "]").val();
                            //alert(ItemValue);
                            var SelectItemValue = document.getElementById("SelectItemValue" + index + "");
                            SelectItemValue.value = ItemValue;

                        }
                    </script>
                    <table id="tbRefExtendProperty" width="100%" class="division">
                       <tr>
                            <td colspan="7">
                                <input id="BtAdd" type="button" value="添加一个扩展属性" />&nbsp;<input id="BtDel" type="button" value="删除扩展属性" />
                                </td>
                        </tr>
                        <tr>
                            <td class="CheckBoxEdit"></td>
                            <td class="CheckBoxEdit">
                                <input id="CKA" name="CKA" type="checkbox" /></td>
                            <td >
                                属性名称</td>
                            <td >
                                表现类型</td>
                            <td >
                                选择项可选值(注：用"|"隔开)
                                </td>
                            <td >
                                显示
                                </td>
                            <td >
                                排序</td>
                        </tr>
                          <asp:Repeater ID="rptList" runat="server" >
                            <ItemTemplate>
                                <tr>
                                    <td class="CheckBoxEdit"><%# Container.ItemIndex +1 %></td>
                                    <td class="CheckBoxEdit">
                                        <input id="CK" name="CK" type="checkbox" value='<%# Eval("ID")%>'/>
                                        <input id="CKProperty" name="CKProperty" type="checkbox" checked="checked" value='<%# Eval("ID")%>' class="Display"/>
                                        </td>
                                    <td>
                                        <input id="ExtendPropertyName" type="text" name="ExtendPropertyName" value='<%# Eval("ExtendPropertyName")%>' style="width:100px;" maxlength="50px" /></td>
                                    <td >
                                        <select id="StageShowType<%# Eval("ID")%>" name="StageShowType" onchange='StageShowTypeOnchange(<%# Eval("ID")%>)' style="width:120px;">
                                            <optgroup label="选择项">
                                                <option value="0" <%# Eval("StageShowType").ToString()=="0"?"selected='selected'":""%>>选择项-渐进式筛选</option>
                                                <option value="1" <%# Eval("StageShowType").ToString()=="1"?"selected='selected'":""%>>选择项-下拉筛选</option>
                                                <option value="2" <%# Eval("StageShowType").ToString()=="2"?"selected='selected'":""%>>选择项-不可筛选</option>
                                            </optgroup>
                                            <optgroup label="输入项">
                                                <option value="3" <%# Eval("StageShowType").ToString()=="3"?"selected='selected'":""%>>输入项-可搜索</option>
                                                <option value="4" <%# Eval("StageShowType").ToString()=="4"?"selected='selected'":""%>>输入项-不可搜索</option>
                                            </optgroup>
                                        </select>
                                        </td>
                                    <td>
                                         <input id="ItemValue<%# Eval("ID")%>" type="text" name="ItemValue" value='<%# Eval("SelectItemValue")%>' onchange='ItemValueOnchange(<%# Eval("ID")%>)' style="width:250px;" maxlength="100" />
                                         <input id="SelectItemValue<%# Eval("ID")%>" type="text" name="SelectItemValue" value='<%# Eval("SelectItemValue")%>' class="Display" />
                                         
                                        </td>
                                    <td>
                                        <select id="IsShow" name="IsShow">
                                                <option value="1" <%# Eval("IsShow").ToString()=="1"?"selected='selected'":""%> >是</option>
                                                <option value="0" <%# Eval("IsShow").ToString()=="0"?"selected='selected'":""%> >否</option>
                                        </select>
                                        </td>
                                    <td>
                                        <input id="OrderID" type="text" name="OrderID" value='<%# Eval("IsOrder")%>' style="width:50px;"/></td>
                                </tr>
                            </ItemTemplate>
                        </asp:Repeater>
                        
                    </table>
                 <!-- End扩展属性 -->
        </div>
       <%}%>
         <% if (IsRefDescripttion == 1)
            { %>
           <div id="tabs-4">
                 <!-- Begion 详细参数 -->
                    <script type="text/javascript">
                        $(document).ready(function () {
                            //隐藏模板tr
                            $("#tbRefDescripttion tr").eq(2).hide();
                            var i = 0;
                            $("#BtAddTabs4").click(function () {
                                //复制一行
                                var tr = $("#tbRefDescripttion tr").eq(2).clone();
                                tr.find("td").get(0).innerHTML = ++i;
                                tr.show();
                                tr.appendTo("#tbRefDescripttion");
                            });
                            $("#BtDelTabs4").click(function () {
                                if (ifCheckCommon("tbRefDescripttion")) {
                                    if (confirm("你确定要删除！")) {
                                        $("#tbRefDescripttion tr:gt(2)").each(function () {
                                            if ($(this).find("#CKTabs4").get(0).checked == true) {
                                                $(this).remove();
                                            }
                                        });
                                        i = 0;
                                        $("#tbRefDescripttion tr:gt(2)").each(function () {
                                            $(this).find("td").get(0).innerHTML = ++i;
                                        });
                                        $("#CKATabs4").attr("checked", false);
                                    }
                                }
                                else {
                                    alert('请选择记录！');
                                    return false;
                                }
                            });
                            $("#CKATabs4").click(function () {
                                $("#tbRefDescripttion tr:gt(2)").each(function () {
                                    $(this).find("#CKTabs4").get(0).checked = $("#CKATabs4").get(0).checked;
                                });
                            });
                        })
                    </script>
                    <table id="tbRefDescripttion" width="100%" class="division">
                       <tr>
                            <td colspan="7">
                                <input id="BtAddTabs4" type="button" value="添加详细参数" />&nbsp;<input id="BtDelTabs4" type="button" value="删除详细参数" />
                                </td>
                        </tr>
                        <tr>
                            <td class="CheckBoxEdit"></td>
                            <td class="CheckBoxEdit">
                                <input id="CKATabs4" name="CKATabs4" type="checkbox" /></td>
                            <td >
                                参数名称</td>
                        </tr>
                        <tr>
                            <td class="CheckBoxEdit"></td>
                            <td class="CheckBoxEdit">
                                <input id="CKTabs4" name="CKTabs4" type="checkbox"/>
                                <input id="CKTabs4Descripttion" name="CKTabs4Descripttion" type="checkbox" checked="checked" class="Display"/>
                                </td>
                            <td>
                                <input id="DescripttionName" type="text" name="DescripttionName" maxlength="50" />
                                </td>
                        </tr>
                        <asp:Repeater ID="rptListTabs4" runat="server" >
                            <ItemTemplate>
                               <tr>
                                    <td class="CheckBoxEdit"></td>
                                    <td class="CheckBoxEdit">
                                        <input id="CKTabs4" name="CKTabs4" type="checkbox" value='<%# Eval("ID")%>'/>
                                        <input id="CKTabs4Descripttion" name="CKTabs4Descripttion" type="checkbox" checked="checked" value='<%# Eval("ID")%>' class="Display" />
                                       
                                        </td>
                                    <td>
                                        <input id="DescripttionName" type="text" name="DescripttionName" value='<%# Eval("DescripttionName")%>' maxlength="50"/>
                                        </td>
                                </tr>
                            </ItemTemplate>
                        </asp:Repeater>
                    </table>
                </div>
                 <!-- End 详细参数 -->
        <%}%>
        <% if (IsRefShopMustInfo == 1)
            { %>
            <div id="tabs-5">
                <!-- Begin购物必填 -->
                    <script type="text/javascript">
                        $(document).ready(function () {
                            //隐藏模板tr
                            $("#tbRefShopMustInfo tr").eq(2).hide();
                            var i = 0;
                            $("#BtAddTabs5").click(function () {
                                //复制一行
                                var tr = $("#tbRefShopMustInfo tr").eq(2).clone();
                                tr.find("td").get(0).innerHTML = ++i;
                                tr.show();
                                tr.appendTo("#tbRefShopMustInfo");
                            });
                            $("#BtDelTab5").click(function () {
                                if (ifCheckCommon("tbRefShopMustInfo")) {
                                    if (confirm("你确定要删除！")) {
                                        $("#tbRefShopMustInfo tr:gt(2)").each(function () {
                                            if ($(this).find("#CKTabs5").get(0).checked == true) {
                                                $(this).remove();
                                            }
                                        });
                                        i = 0;
                                        $("#tbRefShopMustInfo tr:gt(2)").each(function () {
                                            $(this).find("td").get(0).innerHTML = ++i;
                                        });
                                        $("#CKATabs5").attr("checked", false);
                                    }
                                }
                                else {
                                    alert('请选择记录！');
                                    return false;
                                }
                            });
                            $("#CKATabs5").click(function () {
                                $("#tbRefShopMustInfo tr:gt(2)").each(function () {
                                    $(this).find("#CKTabs5").get(0).checked = $("#CKATabs5").get(0).checked;
                                });
                            });
                        })
                    </script>
                    <table id="tbRefShopMustInfo" width="100%" class="division">
                       <tr>
                            <td colspan="7">
                                <input id="BtAddTabs5" type="button" value="添加一个购物必填" />&nbsp;<input id="BtDelTab5" type="button" value="删除购物必填" />
                                </td>
                        </tr>
                        <tr>
                            <td class="CheckBoxEdit"></td>
                            <td class="CheckBoxEdit">
                                <input id="CKATabs5" name="CKATabs5" type="checkbox" /></td>
                            <td >
                                用户购买必填项</td>
                            <td >
                                输入类型</td>
                            <td >
                                可选值 (用"|"分隔)
                                </td>
                        </tr>
                            <tr>
                                <td class="CheckBoxEdit" ></td>
                                    <td class="CheckBoxEdit">
                                        <input id="CKTabs5" name="CKTabs5" type="checkbox" />
                                        <input id="CKTabs5MustInfo" name="CKTabs5MustInfo" type="checkbox" checked="checked" class ="Display" />
                                        </td>
                                    <td>
                                        <input id="MustInfoName" type="text" name="MustInfoName" maxlength="50" /></td>
                                    <td >
                                        <select id="ShowWay" name="ShowWay">
                                            <option value="0">单行输入项</option>
                                            <option value="1">多行输入项</option>
                                            <option value="2">选择项</option>
                                        </select>
                                        </td>
                                    <td>
                                         <input id="MustInfoValue" type="text" name="MustInfoValue" maxlength="100" />
                                        </td>
                                </tr>
                                <asp:Repeater ID="rptListTabs5" runat="server" >
                                    <ItemTemplate>
                                        <tr>
                                            <td class="CheckBoxEdit"></td>
                                                <td class="CheckBoxEdit">
                                                    <input id="CKTabs5" name="CKTabs5" type="checkbox" value='<%# Eval("ID")%>'/>
                                                    <input id="CKTabs5MustInfo" name="CKTabs5MustInfo" type="checkbox" checked="checked" value='<%# Eval("ID")%>' class="Display"/>
                                                    </td>
                                                <td>
                                                    <input id="MustInfoName" type="text" name="MustInfoName" value='<%# Eval("MustInfoName")%>'  maxlength="50" /></td>
                                                <td >
                                                    <select id="ShowWay" name="ShowWay">
                                                         <option value="0" <%# Eval("ShowWay").ToString()=="0"? "selected='selected'":"" %>>单行输入项</option>
                                                         <option value="1" <%# Eval("ShowWay").ToString()=="1"? "selected='selected'":"" %>>多行输入项</option>
                                                         <option value="2" <%# Eval("ShowWay").ToString()=="2"? "selected='selected'":"" %>>选择项</option>
                                                    </select>
                                                    </td>
                                                <td>
                                                     <input id="MustInfoValue" type="text" name="MustInfoValue" value='<%# Eval("MustInfoValue")%>' maxlength="100"/>
                                                    </td>
                                            </tr>
                                    </ItemTemplate>
                                </asp:Repeater>
                    </table>
                <!--End购物必填-->
            </div>
        <%}%>
          </div>
          <div class="EditBtn">
         <asp:Button ID="btUp" runat="server" Text="提交" OnClick="btUp_Click" />
         <input type="button" value="取消" onclick="javascript:history.go(-1)" />
         </div>
    </div>
    </form>
</body>
</html>
